package com.aiyun.dubbo.service.impl;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

import com.aiyun.dubbo.service.HelloService;
import org.apache.dubbo.config.annotation.Service;
import org.apache.tomcat.jni.Local;
import org.slf4j.Logger;

import org.springframework.stereotype.Component;

import static org.slf4j.LoggerFactory.getLogger;


@Component
@Service
public class HelloServiceImpl implements HelloService {

	private final Logger logger = getLogger(HelloServiceImpl.class);

	public String sayHello(String name) {
		logger.info("Dubbo request for say hello");
		return "Hello, " + name;
	}

	@Override
	public String getCurrentTime() {
		logger.info("Dubbo request from current time");
		return LocalDateTime.now().format(DateTimeFormatter.ISO_LOCAL_DATE_TIME);
	}
}
